com.willowtreeapps.android.shared
Class OAKImageCache
java.lang.Object
com.github.droidfu.cachefu.AbstractCache<String,byte[]>
com.github.droidfu.cachefu.ImageCache
com.willowtreeapps.android.shared.OAKImageCache
- All Implemented Interfaces:
- Map<String,byte[]>
public class OAKImageCache
- extends ImageCache
Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
Constructor Summary |
OAKImageCache(int initialCapacity,
long expirationInMinutes,
int maxConcurrentThreads)
|
Methods inherited from class com.github.droidfu.cachefu.AbstractCache |
clear, containsKey, containsKeyInMemory, containsValue, enableDiskCache, entrySet, get, getDiskCacheDirectory, getFileForKey, isDiskCacheEnabled, isEmpty, keySet, putAll, remove, removeKey, setDiskCacheEnabled, size, values |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOG_TAG
public static final String LOG_TAG
OAKImageCache
public OAKImageCache(int initialCapacity,
long expirationInMinutes,
int maxConcurrentThreads)
getBitmap
public android.graphics.Bitmap getBitmap(Object elementKey)
- Overrides:
getBitmap
in class ImageCache
put
public byte[] put(String imageUrl,
byte[] data)
- Description copied from class:
AbstractCache
- Writes an element to the cache. NOTE: If disk caching is enabled, this will write through to
the disk, which may introduce a performance penalty.
- Specified by:
put
in interface Map<String,byte[]>
- Overrides:
put
in class AbstractCache<String,byte[]>
putToDisk
public void putToDisk(String imageUrl,
byte[] data)
getCacheAllocated
public int getCacheAllocated()
getCacheLimit
public int getCacheLimit()
setCacheLimit
public void setCacheLimit(int newLimit)
- Set how large the cache may grow before old images are discarded.
- Parameters:
newLimit
- New cache size in bytes.
updateContents
public void updateContents()
- Populates the cache with information about images already on disk. Should be run
after enabling disk caching -- if not, previously existing images on disk will not be
considered toward allocation limits and old image removal.
cacheToDisk
protected void cacheToDisk(String key,
byte[] value)
- Overrides:
cacheToDisk
in class AbstractCache<String,byte[]>
getImageArea
protected int getImageArea(byte[] data)
getContext
public android.content.Context getContext()
setContext
public void setContext(android.content.Context context)
isSafeMode
public boolean isSafeMode()
setSafeMode
public void setSafeMode(boolean safeMode)
Copyright © 2011. All Rights Reserved.